#include <iostream>
#include <terminal/oiltrans.h>
#include <model.h>
#include <exception>

#include <sqlite_orm/sqlite_orm.h>
#include <logger/logger.h>

int main()
{
    cores::loggers::Logger::instance()->setLogDir("./logs");
    try
    {
        auto s = cores::database::terminal::OilTrans::getRawTransDataS();
        XLOG("成功获取原始数据:%d条", s.size());
        XLOG("成功获取原始数据:%d条", s.size());
        XLOG("成功获取原始数据:%d条", s.size());
        XLOG("成功获取原始数据:%d条", s.size());
    }
    catch (const std::system_error &e)
    {
        // std::cout << "[" << e.code() << "]" << e.what() << std::endl;
        XLOG("[%d]%s", e.code(), e.what());
    }

    try
    {
        auto oil_trans = cores::database::terminal::OilTrans::getSerialNumberDataS();
        std::cout << __FILE__ << ":" << __LINE__ << std::endl;
    }
    catch (const std::system_error &e)
    {
        std::cout << "[" << e.code() << "]" << e.what() << std::endl;
    }

    try
    {
        auto tank_trans = cores::database::terminal::OilTrans::getNoUploadLlqDataS();
        std::cout << __FILE__ << ":" << __LINE__ << std::endl;
    }
    catch (const std::system_error &e)
    {
        std::cout << "[" << e.code() << "]" << e.what() << std::endl;
    }

    std::cout << "OK" << std::endl;

    cores::loggers::Logger::instance()->stop();

    XLOG("成功获取原始数据:%d条", 100);

    return 0;
}
